<?php
return [
    'defaultRoute' => 'site/index',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-backend',
            'cookieValidationKey' => 'e2Rm8ulf0nHQTpsw8Z7jsAuQtMS',
            'baseUrl' => '/backend',
        ],
        'user' => [
            'identityClass' => 'backend\models\AdminUser',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'errorHandler' => [
            'class' => 'backend\components\AdminErrorHandler'
        ],
        'session' => [
            // 使用redis做session
            'name' => "ADMIN-SESSION",
            'class' => 'yii\redis\Session',
            'redis' => 'redis_session',
            // 与后台区分开会话key，保证前后台能同时单独登录
            'timeout' => 86400 * 7,
            'keyPrefix' => 'backend-session:',
            'cookieParams' => ['lifetime' => 86400 * 7, 'httponly' => true],
        ],
    ],
];
